{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "import importlib\n",
    "from datetime import datetime\n",
    "\n",
    "from vnpy.app.spread_trading.backtesting import BacktestingEngine\n",
    "from vnpy.app.spread_trading.base import LegData, SpreadData\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "# from strategies.statistical_arbitrage_grid_strategy import StatisticalArbitrageGridStrategy\n",
    "from strategies.statistical_arbitrage_grid_strategy import StatisticalArbitrageGridStrategy\n",
    "from strategies.statistical_arbitrage_strategy import StatisticalArbitrageStrategy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "spread = SpreadData(\n",
    "    name=\"BTC-Spread\",\n",
    "    legs=[LegData(\"BTC-USD-B.OKEX\"), LegData(\"BTC-USD-Q.OKEX\")],\n",
    "    price_multipliers={\"BTC-USD-B.OKEX\": 1, \"BTC-USD-Q.OKEX\": -1},\n",
    "    trading_multipliers={\"BTC-USD-B.OKEX\": 1, \"BTC-USD-Q.OKEX\": -1},\n",
    "    active_symbol=\"BTC-USD-B.OKEX\",\n",
    "    inverse_contracts={\"BTC-USD-B.OKEX\": True, \"BTC-USD-Q.OKEX\": False},\n",
    "    min_volume=1\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 计算手续费\n",
    "rate_1 = 0.05/100\n",
    "rate_2 = 0.05/100\n",
    "rate = (rate_1 + rate_2) / 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [],
   "source": [
    "engine = BacktestingEngine()\n",
    "engine.set_parameters(\n",
    "    spread=spread,\n",
    "    interval=\"1m\",\n",
    "    start=datetime(2020, 3, 1),\n",
    "    end=datetime(2020, 6, 12),\n",
    "    rate=rate,\n",
    "    slippage=0.1,  # 滑点\n",
    "    size=100,\n",
    "    pricetick=0.5,\n",
    "    capital=100_000,\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "statarb_setting = {\n",
    "    \"boll_window\": 70,\n",
    "    \"boll_dev\": 3.8,\n",
    "    \"fixed_pos\":1.0,\n",
    "}\n",
    "\n",
    "statarb_setting1 = {\n",
    "    \"boll_window\": 80,\n",
    "    \"boll_dev\": 3,\n",
    "    \"fixed_pos\":1.0,\n",
    "    \"max_pos\" : 4,\n",
    "    \"price_proportion\": 2.0,\n",
    "    \"pay_up\":5,\n",
    "    \"increase_price\": 10,       \n",
    "    \"interval\": 5\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "# engine.add_strategy(StatisticalArbitrageGridStrategy, statarb_setting1)\n",
    "engine.add_strategy(StatisticalArbitrageStrategy, statarb_setting)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2020-08-31 17:01:44.584286\t开始加载历史数据\n",
      "2020-08-31 17:01:44.584286\t历史数据加载完成，数据量：148267\n",
      "2020-08-31 17:01:44.909101\t策略初始化完成\n",
      "2020-08-31 17:01:44.909101\t开始回放历史数据\n",
      "2020-08-31 17:01:47.882419\t历史数据回放结束\n",
      "2020-08-31 17:01:47.882419\t开始计算逐日盯市盈亏\n",
      "2020-08-31 17:01:47.885398\t逐日盯市盈亏计算完成\n",
      "2020-08-31 17:01:47.885398\t开始计算策略统计指标\n",
      "2020-08-31 17:01:47.892394\t------------------------------\n",
      "2020-08-31 17:01:47.892394\t首个交易日：\t2020-03-11\n",
      "2020-08-31 17:01:47.892394\t最后交易日：\t2020-06-12\n",
      "2020-08-31 17:01:47.892394\t总交易日：\t94\n",
      "2020-08-31 17:01:47.892394\t盈利交易日：\t11\n",
      "2020-08-31 17:01:47.892394\t亏损交易日：\t20\n",
      "2020-08-31 17:01:47.892394\t起始资金：\t100,000.00\n",
      "2020-08-31 17:01:47.892394\t结束资金：\t288,234.00\n",
      "2020-08-31 17:01:47.892394\t总收益率：\t188.23%\n",
      "2020-08-31 17:01:47.892394\t年化收益：\t480.60%\n",
      "2020-08-31 17:01:47.892394\t最大回撤: \t-19,879.29\n",
      "2020-08-31 17:01:47.892394\t百分比最大回撤: -7.08%\n",
      "2020-08-31 17:01:47.892394\t最长回撤天数: \t38\n",
      "2020-08-31 17:01:47.892394\t总盈亏：\t188,234.00\n",
      "2020-08-31 17:01:47.892394\t总手续费：\t59,706.00\n",
      "2020-08-31 17:01:47.892394\t总滑点：\t760.00\n",
      "2020-08-31 17:01:47.892394\t总成交金额：\t119,412,009.00\n",
      "2020-08-31 17:01:47.892394\t总成交笔数：\t76\n",
      "2020-08-31 17:01:47.892394\t日均盈亏：\t2,002.49\n",
      "2020-08-31 17:01:47.892394\t日均手续费：\t635.17\n",
      "2020-08-31 17:01:47.892394\t日均滑点：\t8.09\n",
      "2020-08-31 17:01:47.892394\t日均成交金额：\t1,270,340.52\n",
      "2020-08-31 17:01:47.892394\t日均成交笔数：\t0.8085106382978723\n",
      "2020-08-31 17:01:47.892394\t日均收益率：\t1.13%\n",
      "2020-08-31 17:01:47.892394\t收益标准差：\t8.21%\n",
      "2020-08-31 17:01:47.892394\tSharpe Ratio：\t2.12\n",
      "2020-08-31 17:01:47.892394\t收益回撤比：\t26.60\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "d:\\vnstudio\\lib\\site-packages\\vnpy\\app\\spread_trading\\backtesting.py:284: FutureWarning:\n",
      "\n",
      "\n",
      "The current behaviour of 'Series.argmax' is deprecated, use 'idxmax'\n",
      "instead.\n",
      "The behavior of 'argmax' will be corrected to return the positional\n",
      "maximum in the future. For now, use 'series.values.argmax' or\n",
      "'np.argmax(np.array(values))' to get the position of the maximum\n",
      "row.\n",
      "\n"
     ]
    },
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },
       "data": [
        {
         "mode": "lines",
         "name": "Balance",
         "type": "scatter",
         "x": [
          "2020-03-11",
          "2020-03-12",
          "2020-03-13",
          "2020-03-14",
          "2020-03-15",
          "2020-03-16",
          "2020-03-17",
          "2020-03-18",
          "2020-03-19",
          "2020-03-20",
          "2020-03-21",
          "2020-03-22",
          "2020-03-23",
          "2020-03-24",
          "2020-03-25",
          "2020-03-26",
          "2020-03-27",
          "2020-03-28",
          "2020-03-29",
          "2020-03-30",
          "2020-03-31",
          "2020-04-01",
          "2020-04-02",
          "2020-04-03",
          "2020-04-04",
          "2020-04-05",
          "2020-04-06",
          "2020-04-07",
          "2020-04-08",
          "2020-04-09",
          "2020-04-10",
          "2020-04-11",
          "2020-04-12",
          "2020-04-13",
          "2020-04-14",
          "2020-04-15",
          "2020-04-16",
          "2020-04-17",
          "2020-04-18",
          "2020-04-19",
          "2020-04-20",
          "2020-04-21",
          "2020-04-22",
          "2020-04-23",
          "2020-04-24",
          "2020-04-25",
          "2020-04-26",
          "2020-04-27",
          "2020-04-28",
          "2020-04-29",
          "2020-04-30",
          "2020-05-01",
          "2020-05-02",
          "2020-05-03",
          "2020-05-04",
          "2020-05-05",
          "2020-05-06",
          "2020-05-07",
          "2020-05-08",
          "2020-05-09",
          "2020-05-10",
          "2020-05-11",
          "2020-05-12",
          "2020-05-13",
          "2020-05-14",
          "2020-05-15",
          "2020-05-16",
          "2020-05-17",
          "2020-05-18",
          "2020-05-19",
          "2020-05-20",
          "2020-05-21",
          "2020-05-22",
          "2020-05-23",
          "2020-05-24",
          "2020-05-25",
          "2020-05-26",
          "2020-05-27",
          "2020-05-28",
          "2020-05-29",
          "2020-05-30",
          "2020-05-31",
          "2020-06-01",
          "2020-06-02",
          "2020-06-03",
          "2020-06-04",
          "2020-06-05",
          "2020-06-06",
          "2020-06-07",
          "2020-06-08",
          "2020-06-09",
          "2020-06-10",
          "2020-06-11",
          "2020-06-12"
         ],
         "xaxis": "x",
         "y": [
          100000,
          209831.508,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280485.155,
          280848.609,
          280848.609,
          280848.609,
          280848.609,
          280848.609,
          280848.609,
          280943.278,
          279127.484,
          270898.356,
          270898.356,
          270898.356,
          270694.3055,
          270694.3055,
          270694.3055,
          270694.3055,
          271443.8965,
          269250.4995,
          269007.648,
          269007.648,
          269007.648,
          269007.648,
          269007.648,
          269007.648,
          268798.07149999996,
          268798.07149999996,
          268798.07149999996,
          268798.07149999996,
          268156.9075,
          268156.9075,
          268034.7625,
          268034.7625,
          268034.7625,
          268034.7625,
          267517.77,
          266592.1425,
          266592.1425,
          266857.33,
          265730.6545,
          265730.6545,
          265730.6545,
          264696.6495,
          264696.6495,
          262418.7965,
          261064.7415,
          261063.99,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272828.53949999996,
          272664.81299999997,
          272664.81299999997,
          272664.81299999997,
          270323.8575,
          270447.7645,
          269880.6905,
          268692.326,
          268692.326,
          268692.326,
          269706.75,
          269706.75,
          269706.75,
          278457.184,
          278457.184,
          278457.184,
          278457.184,
          278457.184,
          278457.184,
          288772.196,
          288772.196,
          288772.196,
          288233.99549999996,
          288233.99549999996
         ],
         "yaxis": "y"
        },
        {
         "fill": "tozeroy",
         "fillcolor": "red",
         "mode": "lines",
         "name": "Drawdown",
         "type": "scatter",
         "x": [
          "2020-03-11",
          "2020-03-12",
          "2020-03-13",
          "2020-03-14",
          "2020-03-15",
          "2020-03-16",
          "2020-03-17",
          "2020-03-18",
          "2020-03-19",
          "2020-03-20",
          "2020-03-21",
          "2020-03-22",
          "2020-03-23",
          "2020-03-24",
          "2020-03-25",
          "2020-03-26",
          "2020-03-27",
          "2020-03-28",
          "2020-03-29",
          "2020-03-30",
          "2020-03-31",
          "2020-04-01",
          "2020-04-02",
          "2020-04-03",
          "2020-04-04",
          "2020-04-05",
          "2020-04-06",
          "2020-04-07",
          "2020-04-08",
          "2020-04-09",
          "2020-04-10",
          "2020-04-11",
          "2020-04-12",
          "2020-04-13",
          "2020-04-14",
          "2020-04-15",
          "2020-04-16",
          "2020-04-17",
          "2020-04-18",
          "2020-04-19",
          "2020-04-20",
          "2020-04-21",
          "2020-04-22",
          "2020-04-23",
          "2020-04-24",
          "2020-04-25",
          "2020-04-26",
          "2020-04-27",
          "2020-04-28",
          "2020-04-29",
          "2020-04-30",
          "2020-05-01",
          "2020-05-02",
          "2020-05-03",
          "2020-05-04",
          "2020-05-05",
          "2020-05-06",
          "2020-05-07",
          "2020-05-08",
          "2020-05-09",
          "2020-05-10",
          "2020-05-11",
          "2020-05-12",
          "2020-05-13",
          "2020-05-14",
          "2020-05-15",
          "2020-05-16",
          "2020-05-17",
          "2020-05-18",
          "2020-05-19",
          "2020-05-20",
          "2020-05-21",
          "2020-05-22",
          "2020-05-23",
          "2020-05-24",
          "2020-05-25",
          "2020-05-26",
          "2020-05-27",
          "2020-05-28",
          "2020-05-29",
          "2020-05-30",
          "2020-05-31",
          "2020-06-01",
          "2020-06-02",
          "2020-06-03",
          "2020-06-04",
          "2020-06-05",
          "2020-06-06",
          "2020-06-07",
          "2020-06-08",
          "2020-06-09",
          "2020-06-10",
          "2020-06-11",
          "2020-06-12"
         ],
         "xaxis": "x2",
         "y": [
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          -1815.7939999999944,
          -10044.921999999962,
          -10044.921999999962,
          -10044.921999999962,
          -10248.972499999974,
          -10248.972499999974,
          -10248.972499999974,
          -10248.972499999974,
          -9499.381500000018,
          -11692.778500000015,
          -11935.630000000005,
          -11935.630000000005,
          -11935.630000000005,
          -11935.630000000005,
          -11935.630000000005,
          -11935.630000000005,
          -12145.20650000003,
          -12145.20650000003,
          -12145.20650000003,
          -12145.20650000003,
          -12786.37050000002,
          -12786.37050000002,
          -12908.51549999998,
          -12908.51549999998,
          -12908.51549999998,
          -12908.51549999998,
          -13425.507999999973,
          -14351.135499999975,
          -14351.135499999975,
          -14085.947999999975,
          -15212.623499999987,
          -15212.623499999987,
          -15212.623499999987,
          -16246.628499999992,
          -16246.628499999992,
          -18524.481499999994,
          -19878.536499999987,
          -19879.288,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8114.738500000036,
          -8278.465000000026,
          -8278.465000000026,
          -8278.465000000026,
          -10619.420500000007,
          -10495.513500000001,
          -11062.587499999965,
          -12250.95199999999,
          -12250.95199999999,
          -12250.95199999999,
          -11236.527999999991,
          -11236.527999999991,
          -11236.527999999991,
          -2486.0939999999828,
          -2486.0939999999828,
          -2486.0939999999828,
          -2486.0939999999828,
          -2486.0939999999828,
          -2486.0939999999828,
          0,
          0,
          0,
          -538.2005000000354,
          -538.2005000000354
         ],
         "yaxis": "y2"
        },
        {
         "name": "Daily Pnl",
         "type": "bar",
         "xaxis": "x3",
         "y": [
          0,
          109831.508,
          70653.647,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          363.45399999999995,
          0,
          0,
          0,
          0,
          0,
          94.66899999999987,
          -1815.7939999999999,
          -8229.128,
          0,
          0,
          -204.05050000000028,
          0,
          0,
          0,
          749.5909999999999,
          -2193.397,
          -242.8515,
          0,
          0,
          0,
          0,
          0,
          -209.57650000000012,
          0,
          0,
          0,
          -641.164,
          0,
          -122.14499999999998,
          0,
          0,
          0,
          -516.9925000000001,
          -925.6274999999998,
          0,
          265.1875,
          -1126.6754999999998,
          0,
          0,
          -1034.005,
          0,
          -2277.853,
          -1354.0549999999998,
          -0.7514999999999645,
          11764.549500000001,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          -163.72650000000021,
          0,
          0,
          -2340.9555,
          123.90699999999993,
          -567.0740000000001,
          -1188.3645000000001,
          0,
          0,
          1014.424,
          0,
          0,
          8750.434000000001,
          0,
          0,
          0,
          0,
          0,
          10315.011999999999,
          0,
          0,
          -538.2004999999999,
          0
         ],
         "yaxis": "y3"
        },
        {
         "name": "Days",
         "nbinsx": 100,
         "type": "histogram",
         "x": [
          0,
          109831.508,
          70653.647,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          363.45399999999995,
          0,
          0,
          0,
          0,
          0,
          94.66899999999987,
          -1815.7939999999999,
          -8229.128,
          0,
          0,
          -204.05050000000028,
          0,
          0,
          0,
          749.5909999999999,
          -2193.397,
          -242.8515,
          0,
          0,
          0,
          0,
          0,
          -209.57650000000012,
          0,
          0,
          0,
          -641.164,
          0,
          -122.14499999999998,
          0,
          0,
          0,
          -516.9925000000001,
          -925.6274999999998,
          0,
          265.1875,
          -1126.6754999999998,
          0,
          0,
          -1034.005,
          0,
          -2277.853,
          -1354.0549999999998,
          -0.7514999999999645,
          11764.549500000001,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          0,
          -163.72650000000021,
          0,
          0,
          -2340.9555,
          123.90699999999993,
          -567.0740000000001,
          -1188.3645000000001,
          0,
          0,
          1014.424,
          0,
          0,
          8750.434000000001,
          0,
          0,
          0,
          0,
          0,
          10315.011999999999,
          0,
          0,
          -538.2004999999999,
          0
         ],
         "xaxis": "x4",
         "yaxis": "y4"
        }
       ],
       "layout": {
        "annotations": [
         {
          "font": {
           "size": 16
          },
          "showarrow": false,
          "text": "Balance",
          "x": 0.5,
          "xanchor": "center",
          "xref": "paper",
          "y": 1,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {
           "size": 16
          },
          "showarrow": false,
          "text": "Drawdown",
          "x": 0.5,
          "xanchor": "center",
          "xref": "paper",
          "y": 0.7350000000000001,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {
           "size": 16
          },
          "showarrow": false,
          "text": "Daily Pnl",
          "x": 0.5,
          "xanchor": "center",
          "xref": "paper",
          "y": 0.47000000000000003,
          "yanchor": "bottom",
          "yref": "paper"
         },
         {
          "font": {
           "size": 16
          },
          "showarrow": false,
          "text": "Pnl Distribution",
          "x": 0.5,
          "xanchor": "center",
          "xref": "paper",
          "y": 0.20500000000000002,
          "yanchor": "bottom",
          "yref": "paper"
         }
        ],
        "height": 1000,
        "template": {
         "data": {
          "bar": [
           {
            "error_x": {
             "color": "#2a3f5f"
            },
            "error_y": {
             "color": "#2a3f5f"
            },
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             }
            },
            "type": "bar"
           }
          ],
          "barpolar": [
           {
            "marker": {
             "line": {
              "color": "#E5ECF6",
              "width": 0.5
             }
            },
            "type": "barpolar"
           }
          ],
          "carpet": [
           {
            "aaxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "baxis": {
             "endlinecolor": "#2a3f5f",
             "gridcolor": "white",
             "linecolor": "white",
             "minorgridcolor": "white",
             "startlinecolor": "#2a3f5f"
            },
            "type": "carpet"
           }
          ],
          "choropleth": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "choropleth"
           }
          ],
          "contour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "contour"
           }
          ],
          "contourcarpet": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "contourcarpet"
           }
          ],
          "heatmap": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmap"
           }
          ],
          "heatmapgl": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "heatmapgl"
           }
          ],
          "histogram": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "histogram"
           }
          ],
          "histogram2d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2d"
           }
          ],
          "histogram2dcontour": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "histogram2dcontour"
           }
          ],
          "mesh3d": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "type": "mesh3d"
           }
          ],
          "parcoords": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "parcoords"
           }
          ],
          "pie": [
           {
            "automargin": true,
            "type": "pie"
           }
          ],
          "scatter": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter"
           }
          ],
          "scatter3d": [
           {
            "line": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatter3d"
           }
          ],
          "scattercarpet": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattercarpet"
           }
          ],
          "scattergeo": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergeo"
           }
          ],
          "scattergl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattergl"
           }
          ],
          "scattermapbox": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scattermapbox"
           }
          ],
          "scatterpolar": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolar"
           }
          ],
          "scatterpolargl": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterpolargl"
           }
          ],
          "scatterternary": [
           {
            "marker": {
             "colorbar": {
              "outlinewidth": 0,
              "ticks": ""
             }
            },
            "type": "scatterternary"
           }
          ],
          "surface": [
           {
            "colorbar": {
             "outlinewidth": 0,
             "ticks": ""
            },
            "colorscale": [
             [
              0,
              "#0d0887"
             ],
             [
              0.1111111111111111,
              "#46039f"
             ],
             [
              0.2222222222222222,
              "#7201a8"
             ],
             [
              0.3333333333333333,
              "#9c179e"
             ],
             [
              0.4444444444444444,
              "#bd3786"
             ],
             [
              0.5555555555555556,
              "#d8576b"
             ],
             [
              0.6666666666666666,
              "#ed7953"
             ],
             [
              0.7777777777777778,
              "#fb9f3a"
             ],
             [
              0.8888888888888888,
              "#fdca26"
             ],
             [
              1,
              "#f0f921"
             ]
            ],
            "type": "surface"
           }
          ],
          "table": [
           {
            "cells": {
             "fill": {
              "color": "#EBF0F8"
             },
             "line": {
              "color": "white"
             }
            },
            "header": {
             "fill": {
              "color": "#C8D4E3"
             },
             "line": {
              "color": "white"
             }
            },
            "type": "table"
           }
          ]
         },
         "layout": {
          "annotationdefaults": {
           "arrowcolor": "#2a3f5f",
           "arrowhead": 0,
           "arrowwidth": 1
          },
          "coloraxis": {
           "colorbar": {
            "outlinewidth": 0,
            "ticks": ""
           }
          },
          "colorscale": {
           "diverging": [
            [
             0,
             "#8e0152"
            ],
            [
             0.1,
             "#c51b7d"
            ],
            [
             0.2,
             "#de77ae"
            ],
            [
             0.3,
             "#f1b6da"
            ],
            [
             0.4,
             "#fde0ef"
            ],
            [
             0.5,
             "#f7f7f7"
            ],
            [
             0.6,
             "#e6f5d0"
            ],
            [
             0.7,
             "#b8e186"
            ],
            [
             0.8,
             "#7fbc41"
            ],
            [
             0.9,
             "#4d9221"
            ],
            [
             1,
             "#276419"
            ]
           ],
           "sequential": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ],
           "sequentialminus": [
            [
             0,
             "#0d0887"
            ],
            [
             0.1111111111111111,
             "#46039f"
            ],
            [
             0.2222222222222222,
             "#7201a8"
            ],
            [
             0.3333333333333333,
             "#9c179e"
            ],
            [
             0.4444444444444444,
             "#bd3786"
            ],
            [
             0.5555555555555556,
             "#d8576b"
            ],
            [
             0.6666666666666666,
             "#ed7953"
            ],
            [
             0.7777777777777778,
             "#fb9f3a"
            ],
            [
             0.8888888888888888,
             "#fdca26"
            ],
            [
             1,
             "#f0f921"
            ]
           ]
          },
          "colorway": [
           "#636efa",
           "#EF553B",
           "#00cc96",
           "#ab63fa",
           "#FFA15A",
           "#19d3f3",
           "#FF6692",
           "#B6E880",
           "#FF97FF",
           "#FECB52"
          ],
          "font": {
           "color": "#2a3f5f"
          },
          "geo": {
           "bgcolor": "white",
           "lakecolor": "white",
           "landcolor": "#E5ECF6",
           "showlakes": true,
           "showland": true,
           "subunitcolor": "white"
          },
          "hoverlabel": {
           "align": "left"
          },
          "hovermode": "closest",
          "mapbox": {
           "style": "light"
          },
          "paper_bgcolor": "white",
          "plot_bgcolor": "#E5ECF6",
          "polar": {
           "angularaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "radialaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "scene": {
           "xaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "yaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           },
           "zaxis": {
            "backgroundcolor": "#E5ECF6",
            "gridcolor": "white",
            "gridwidth": 2,
            "linecolor": "white",
            "showbackground": true,
            "ticks": "",
            "zerolinecolor": "white"
           }
          },
          "shapedefaults": {
           "line": {
            "color": "#2a3f5f"
           }
          },
          "ternary": {
           "aaxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "baxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           },
           "bgcolor": "#E5ECF6",
           "caxis": {
            "gridcolor": "white",
            "linecolor": "white",
            "ticks": ""
           }
          },
          "title": {
           "x": 0.05
          },
          "xaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          },
          "yaxis": {
           "automargin": true,
           "gridcolor": "white",
           "linecolor": "white",
           "ticks": "",
           "title": {
            "standoff": 15
           },
           "zerolinecolor": "white",
           "zerolinewidth": 2
          }
         }
        },
        "width": 1000,
        "xaxis": {
         "anchor": "y",
         "domain": [
          0,
          1
         ]
        },
        "xaxis2": {
         "anchor": "y2",
         "domain": [
          0,
          1
         ]
        },
        "xaxis3": {
         "anchor": "y3",
         "domain": [
          0,
          1
         ]
        },
        "xaxis4": {
         "anchor": "y4",
         "domain": [
          0,
          1
         ]
        },
        "yaxis": {
         "anchor": "x",
         "domain": [
          0.7949999999999999,
          1
         ]
        },
        "yaxis2": {
         "anchor": "x2",
         "domain": [
          0.53,
          0.7350000000000001
         ]
        },
        "yaxis3": {
         "anchor": "x3",
         "domain": [
          0.265,
          0.47000000000000003
         ]
        },
        "yaxis4": {
         "anchor": "x4",
         "domain": [
          0,
          0.20500000000000002
         ]
        }
       }
      },
      "text/html": [
       "<div>\n",
       "        \n",
       "        \n",
       "            <div id=\"bec021a7-f50c-427c-915a-ce5359bc1d36\" class=\"plotly-graph-div\" style=\"height:1000px; width:1000px;\"></div>\n",
       "            <script type=\"text/javascript\">\n",
       "                require([\"plotly\"], function(Plotly) {\n",
       "                    window.PLOTLYENV=window.PLOTLYENV || {};\n",
       "                    \n",
       "                if (document.getElementById(\"bec021a7-f50c-427c-915a-ce5359bc1d36\")) {\n",
       "                    Plotly.newPlot(\n",
       "                        'bec021a7-f50c-427c-915a-ce5359bc1d36',\n",
       "                        [{\"mode\": \"lines\", \"name\": \"Balance\", \"type\": \"scatter\", \"x\": [\"2020-03-11\", \"2020-03-12\", \"2020-03-13\", \"2020-03-14\", \"2020-03-15\", \"2020-03-16\", \"2020-03-17\", \"2020-03-18\", \"2020-03-19\", \"2020-03-20\", \"2020-03-21\", \"2020-03-22\", \"2020-03-23\", \"2020-03-24\", \"2020-03-25\", \"2020-03-26\", \"2020-03-27\", \"2020-03-28\", \"2020-03-29\", \"2020-03-30\", \"2020-03-31\", \"2020-04-01\", \"2020-04-02\", \"2020-04-03\", \"2020-04-04\", \"2020-04-05\", \"2020-04-06\", \"2020-04-07\", \"2020-04-08\", \"2020-04-09\", \"2020-04-10\", \"2020-04-11\", \"2020-04-12\", \"2020-04-13\", \"2020-04-14\", \"2020-04-15\", \"2020-04-16\", \"2020-04-17\", \"2020-04-18\", \"2020-04-19\", \"2020-04-20\", \"2020-04-21\", \"2020-04-22\", \"2020-04-23\", \"2020-04-24\", \"2020-04-25\", \"2020-04-26\", \"2020-04-27\", \"2020-04-28\", \"2020-04-29\", \"2020-04-30\", \"2020-05-01\", \"2020-05-02\", \"2020-05-03\", \"2020-05-04\", \"2020-05-05\", \"2020-05-06\", \"2020-05-07\", \"2020-05-08\", \"2020-05-09\", \"2020-05-10\", \"2020-05-11\", \"2020-05-12\", \"2020-05-13\", \"2020-05-14\", \"2020-05-15\", \"2020-05-16\", \"2020-05-17\", \"2020-05-18\", \"2020-05-19\", \"2020-05-20\", \"2020-05-21\", \"2020-05-22\", \"2020-05-23\", \"2020-05-24\", \"2020-05-25\", \"2020-05-26\", \"2020-05-27\", \"2020-05-28\", \"2020-05-29\", \"2020-05-30\", \"2020-05-31\", \"2020-06-01\", \"2020-06-02\", \"2020-06-03\", \"2020-06-04\", \"2020-06-05\", \"2020-06-06\", \"2020-06-07\", \"2020-06-08\", \"2020-06-09\", \"2020-06-10\", \"2020-06-11\", \"2020-06-12\"], \"xaxis\": \"x\", \"y\": [100000.0, 209831.508, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280485.155, 280848.609, 280848.609, 280848.609, 280848.609, 280848.609, 280848.609, 280943.278, 279127.484, 270898.356, 270898.356, 270898.356, 270694.3055, 270694.3055, 270694.3055, 270694.3055, 271443.8965, 269250.4995, 269007.648, 269007.648, 269007.648, 269007.648, 269007.648, 269007.648, 268798.07149999996, 268798.07149999996, 268798.07149999996, 268798.07149999996, 268156.9075, 268156.9075, 268034.7625, 268034.7625, 268034.7625, 268034.7625, 267517.77, 266592.1425, 266592.1425, 266857.33, 265730.6545, 265730.6545, 265730.6545, 264696.6495, 264696.6495, 262418.7965, 261064.7415, 261063.99, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272828.53949999996, 272664.81299999997, 272664.81299999997, 272664.81299999997, 270323.8575, 270447.7645, 269880.6905, 268692.326, 268692.326, 268692.326, 269706.75, 269706.75, 269706.75, 278457.184, 278457.184, 278457.184, 278457.184, 278457.184, 278457.184, 288772.196, 288772.196, 288772.196, 288233.99549999996, 288233.99549999996], \"yaxis\": \"y\"}, {\"fill\": \"tozeroy\", \"fillcolor\": \"red\", \"mode\": \"lines\", \"name\": \"Drawdown\", \"type\": \"scatter\", \"x\": [\"2020-03-11\", \"2020-03-12\", \"2020-03-13\", \"2020-03-14\", \"2020-03-15\", \"2020-03-16\", \"2020-03-17\", \"2020-03-18\", \"2020-03-19\", \"2020-03-20\", \"2020-03-21\", \"2020-03-22\", \"2020-03-23\", \"2020-03-24\", \"2020-03-25\", \"2020-03-26\", \"2020-03-27\", \"2020-03-28\", \"2020-03-29\", \"2020-03-30\", \"2020-03-31\", \"2020-04-01\", \"2020-04-02\", \"2020-04-03\", \"2020-04-04\", \"2020-04-05\", \"2020-04-06\", \"2020-04-07\", \"2020-04-08\", \"2020-04-09\", \"2020-04-10\", \"2020-04-11\", \"2020-04-12\", \"2020-04-13\", \"2020-04-14\", \"2020-04-15\", \"2020-04-16\", \"2020-04-17\", \"2020-04-18\", \"2020-04-19\", \"2020-04-20\", \"2020-04-21\", \"2020-04-22\", \"2020-04-23\", \"2020-04-24\", \"2020-04-25\", \"2020-04-26\", \"2020-04-27\", \"2020-04-28\", \"2020-04-29\", \"2020-04-30\", \"2020-05-01\", \"2020-05-02\", \"2020-05-03\", \"2020-05-04\", \"2020-05-05\", \"2020-05-06\", \"2020-05-07\", \"2020-05-08\", \"2020-05-09\", \"2020-05-10\", \"2020-05-11\", \"2020-05-12\", \"2020-05-13\", \"2020-05-14\", \"2020-05-15\", \"2020-05-16\", \"2020-05-17\", \"2020-05-18\", \"2020-05-19\", \"2020-05-20\", \"2020-05-21\", \"2020-05-22\", \"2020-05-23\", \"2020-05-24\", \"2020-05-25\", \"2020-05-26\", \"2020-05-27\", \"2020-05-28\", \"2020-05-29\", \"2020-05-30\", \"2020-05-31\", \"2020-06-01\", \"2020-06-02\", \"2020-06-03\", \"2020-06-04\", \"2020-06-05\", \"2020-06-06\", \"2020-06-07\", \"2020-06-08\", \"2020-06-09\", \"2020-06-10\", \"2020-06-11\", \"2020-06-12\"], \"xaxis\": \"x2\", \"y\": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1815.7939999999944, -10044.921999999962, -10044.921999999962, -10044.921999999962, -10248.972499999974, -10248.972499999974, -10248.972499999974, -10248.972499999974, -9499.381500000018, -11692.778500000015, -11935.630000000005, -11935.630000000005, -11935.630000000005, -11935.630000000005, -11935.630000000005, -11935.630000000005, -12145.20650000003, -12145.20650000003, -12145.20650000003, -12145.20650000003, -12786.37050000002, -12786.37050000002, -12908.51549999998, -12908.51549999998, -12908.51549999998, -12908.51549999998, -13425.507999999973, -14351.135499999975, -14351.135499999975, -14085.947999999975, -15212.623499999987, -15212.623499999987, -15212.623499999987, -16246.628499999992, -16246.628499999992, -18524.481499999994, -19878.536499999987, -19879.288, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8114.738500000036, -8278.465000000026, -8278.465000000026, -8278.465000000026, -10619.420500000007, -10495.513500000001, -11062.587499999965, -12250.95199999999, -12250.95199999999, -12250.95199999999, -11236.527999999991, -11236.527999999991, -11236.527999999991, -2486.0939999999828, -2486.0939999999828, -2486.0939999999828, -2486.0939999999828, -2486.0939999999828, -2486.0939999999828, 0.0, 0.0, 0.0, -538.2005000000354, -538.2005000000354], \"yaxis\": \"y2\"}, {\"name\": \"Daily Pnl\", \"type\": \"bar\", \"xaxis\": \"x3\", \"y\": [0.0, 109831.508, 70653.647, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 363.45399999999995, 0.0, 0.0, 0.0, 0.0, 0.0, 94.66899999999987, -1815.7939999999999, -8229.128, 0.0, 0.0, -204.05050000000028, 0.0, 0.0, 0.0, 749.5909999999999, -2193.397, -242.8515, 0.0, 0.0, 0.0, 0.0, 0.0, -209.57650000000012, 0.0, 0.0, 0.0, -641.164, 0.0, -122.14499999999998, 0.0, 0.0, 0.0, -516.9925000000001, -925.6274999999998, 0.0, 265.1875, -1126.6754999999998, 0.0, 0.0, -1034.005, 0.0, -2277.853, -1354.0549999999998, -0.7514999999999645, 11764.549500000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -163.72650000000021, 0.0, 0.0, -2340.9555, 123.90699999999993, -567.0740000000001, -1188.3645000000001, 0.0, 0.0, 1014.424, 0.0, 0.0, 8750.434000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 10315.011999999999, 0.0, 0.0, -538.2004999999999, 0.0], \"yaxis\": \"y3\"}, {\"name\": \"Days\", \"nbinsx\": 100, \"type\": \"histogram\", \"x\": [0.0, 109831.508, 70653.647, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 363.45399999999995, 0.0, 0.0, 0.0, 0.0, 0.0, 94.66899999999987, -1815.7939999999999, -8229.128, 0.0, 0.0, -204.05050000000028, 0.0, 0.0, 0.0, 749.5909999999999, -2193.397, -242.8515, 0.0, 0.0, 0.0, 0.0, 0.0, -209.57650000000012, 0.0, 0.0, 0.0, -641.164, 0.0, -122.14499999999998, 0.0, 0.0, 0.0, -516.9925000000001, -925.6274999999998, 0.0, 265.1875, -1126.6754999999998, 0.0, 0.0, -1034.005, 0.0, -2277.853, -1354.0549999999998, -0.7514999999999645, 11764.549500000001, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -163.72650000000021, 0.0, 0.0, -2340.9555, 123.90699999999993, -567.0740000000001, -1188.3645000000001, 0.0, 0.0, 1014.424, 0.0, 0.0, 8750.434000000001, 0.0, 0.0, 0.0, 0.0, 0.0, 10315.011999999999, 0.0, 0.0, -538.2004999999999, 0.0], \"xaxis\": \"x4\", \"yaxis\": \"y4\"}],\n",
       "                        {\"annotations\": [{\"font\": {\"size\": 16}, \"showarrow\": false, \"text\": \"Balance\", \"x\": 0.5, \"xanchor\": \"center\", \"xref\": \"paper\", \"y\": 1.0, \"yanchor\": \"bottom\", \"yref\": \"paper\"}, {\"font\": {\"size\": 16}, \"showarrow\": false, \"text\": \"Drawdown\", \"x\": 0.5, \"xanchor\": \"center\", \"xref\": \"paper\", \"y\": 0.7350000000000001, \"yanchor\": \"bottom\", \"yref\": \"paper\"}, {\"font\": {\"size\": 16}, \"showarrow\": false, \"text\": \"Daily Pnl\", \"x\": 0.5, \"xanchor\": \"center\", \"xref\": \"paper\", \"y\": 0.47000000000000003, \"yanchor\": \"bottom\", \"yref\": \"paper\"}, {\"font\": {\"size\": 16}, \"showarrow\": false, \"text\": \"Pnl Distribution\", \"x\": 0.5, \"xanchor\": \"center\", \"xref\": \"paper\", \"y\": 0.20500000000000002, \"yanchor\": \"bottom\", \"yref\": \"paper\"}], \"height\": 1000, \"template\": {\"data\": {\"bar\": [{\"error_x\": {\"color\": \"#2a3f5f\"}, \"error_y\": {\"color\": \"#2a3f5f\"}, \"marker\": {\"line\": {\"color\": \"#E5ECF6\", \"width\": 0.5}}, \"type\": \"bar\"}], \"barpolar\": [{\"marker\": {\"line\": {\"color\": \"#E5ECF6\", \"width\": 0.5}}, \"type\": \"barpolar\"}], \"carpet\": [{\"aaxis\": {\"endlinecolor\": \"#2a3f5f\", \"gridcolor\": \"white\", \"linecolor\": \"white\", \"minorgridcolor\": \"white\", \"startlinecolor\": \"#2a3f5f\"}, \"baxis\": {\"endlinecolor\": \"#2a3f5f\", \"gridcolor\": \"white\", \"linecolor\": \"white\", \"minorgridcolor\": \"white\", \"startlinecolor\": \"#2a3f5f\"}, \"type\": \"carpet\"}], \"choropleth\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"type\": \"choropleth\"}], \"contour\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"colorscale\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.2222222222222222, \"#7201a8\"], [0.3333333333333333, \"#9c179e\"], [0.4444444444444444, \"#bd3786\"], [0.5555555555555556, \"#d8576b\"], [0.6666666666666666, \"#ed7953\"], [0.7777777777777778, \"#fb9f3a\"], [0.8888888888888888, \"#fdca26\"], [1.0, \"#f0f921\"]], \"type\": \"contour\"}], \"contourcarpet\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"type\": \"contourcarpet\"}], \"heatmap\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"colorscale\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.2222222222222222, \"#7201a8\"], [0.3333333333333333, \"#9c179e\"], [0.4444444444444444, \"#bd3786\"], [0.5555555555555556, \"#d8576b\"], [0.6666666666666666, \"#ed7953\"], [0.7777777777777778, \"#fb9f3a\"], [0.8888888888888888, \"#fdca26\"], [1.0, \"#f0f921\"]], \"type\": \"heatmap\"}], \"heatmapgl\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"colorscale\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.2222222222222222, \"#7201a8\"], [0.3333333333333333, \"#9c179e\"], [0.4444444444444444, \"#bd3786\"], [0.5555555555555556, \"#d8576b\"], [0.6666666666666666, \"#ed7953\"], [0.7777777777777778, \"#fb9f3a\"], [0.8888888888888888, \"#fdca26\"], [1.0, \"#f0f921\"]], \"type\": \"heatmapgl\"}], \"histogram\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"histogram\"}], \"histogram2d\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"colorscale\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.2222222222222222, \"#7201a8\"], [0.3333333333333333, \"#9c179e\"], [0.4444444444444444, \"#bd3786\"], [0.5555555555555556, \"#d8576b\"], [0.6666666666666666, \"#ed7953\"], [0.7777777777777778, \"#fb9f3a\"], [0.8888888888888888, \"#fdca26\"], [1.0, \"#f0f921\"]], \"type\": \"histogram2d\"}], \"histogram2dcontour\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"colorscale\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.2222222222222222, \"#7201a8\"], [0.3333333333333333, \"#9c179e\"], [0.4444444444444444, \"#bd3786\"], [0.5555555555555556, \"#d8576b\"], [0.6666666666666666, \"#ed7953\"], [0.7777777777777778, \"#fb9f3a\"], [0.8888888888888888, \"#fdca26\"], [1.0, \"#f0f921\"]], \"type\": \"histogram2dcontour\"}], \"mesh3d\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"type\": \"mesh3d\"}], \"parcoords\": [{\"line\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"parcoords\"}], \"pie\": [{\"automargin\": true, \"type\": \"pie\"}], \"scatter\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scatter\"}], \"scatter3d\": [{\"line\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scatter3d\"}], \"scattercarpet\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scattercarpet\"}], \"scattergeo\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scattergeo\"}], \"scattergl\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scattergl\"}], \"scattermapbox\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scattermapbox\"}], \"scatterpolar\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scatterpolar\"}], \"scatterpolargl\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scatterpolargl\"}], \"scatterternary\": [{\"marker\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"type\": \"scatterternary\"}], \"surface\": [{\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}, \"colorscale\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.2222222222222222, \"#7201a8\"], [0.3333333333333333, \"#9c179e\"], [0.4444444444444444, \"#bd3786\"], [0.5555555555555556, \"#d8576b\"], [0.6666666666666666, \"#ed7953\"], [0.7777777777777778, \"#fb9f3a\"], [0.8888888888888888, \"#fdca26\"], [1.0, \"#f0f921\"]], \"type\": \"surface\"}], \"table\": [{\"cells\": {\"fill\": {\"color\": \"#EBF0F8\"}, \"line\": {\"color\": \"white\"}}, \"header\": {\"fill\": {\"color\": \"#C8D4E3\"}, \"line\": {\"color\": \"white\"}}, \"type\": \"table\"}]}, \"layout\": {\"annotationdefaults\": {\"arrowcolor\": \"#2a3f5f\", \"arrowhead\": 0, \"arrowwidth\": 1}, \"coloraxis\": {\"colorbar\": {\"outlinewidth\": 0, \"ticks\": \"\"}}, \"colorscale\": {\"diverging\": [[0, \"#8e0152\"], [0.1, \"#c51b7d\"], [0.2, \"#de77ae\"], [0.3, \"#f1b6da\"], [0.4, \"#fde0ef\"], [0.5, \"#f7f7f7\"], [0.6, \"#e6f5d0\"], [0.7, \"#b8e186\"], [0.8, \"#7fbc41\"], [0.9, \"#4d9221\"], [1, \"#276419\"]], \"sequential\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.2222222222222222, \"#7201a8\"], [0.3333333333333333, \"#9c179e\"], [0.4444444444444444, \"#bd3786\"], [0.5555555555555556, \"#d8576b\"], [0.6666666666666666, \"#ed7953\"], [0.7777777777777778, \"#fb9f3a\"], [0.8888888888888888, \"#fdca26\"], [1.0, \"#f0f921\"]], \"sequentialminus\": [[0.0, \"#0d0887\"], [0.1111111111111111, \"#46039f\"], [0.2222222222222222, \"#7201a8\"], [0.3333333333333333, \"#9c179e\"], [0.4444444444444444, \"#bd3786\"], [0.5555555555555556, \"#d8576b\"], [0.6666666666666666, \"#ed7953\"], [0.7777777777777778, \"#fb9f3a\"], [0.8888888888888888, \"#fdca26\"], [1.0, \"#f0f921\"]]}, \"colorway\": [\"#636efa\", \"#EF553B\", \"#00cc96\", \"#ab63fa\", \"#FFA15A\", \"#19d3f3\", \"#FF6692\", \"#B6E880\", \"#FF97FF\", \"#FECB52\"], \"font\": {\"color\": \"#2a3f5f\"}, \"geo\": {\"bgcolor\": \"white\", \"lakecolor\": \"white\", \"landcolor\": \"#E5ECF6\", \"showlakes\": true, \"showland\": true, \"subunitcolor\": \"white\"}, \"hoverlabel\": {\"align\": \"left\"}, \"hovermode\": \"closest\", \"mapbox\": {\"style\": \"light\"}, \"paper_bgcolor\": \"white\", \"plot_bgcolor\": \"#E5ECF6\", \"polar\": {\"angularaxis\": {\"gridcolor\": \"white\", \"linecolor\": \"white\", \"ticks\": \"\"}, \"bgcolor\": \"#E5ECF6\", \"radialaxis\": {\"gridcolor\": \"white\", \"linecolor\": \"white\", \"ticks\": \"\"}}, \"scene\": {\"xaxis\": {\"backgroundcolor\": \"#E5ECF6\", \"gridcolor\": \"white\", \"gridwidth\": 2, \"linecolor\": \"white\", \"showbackground\": true, \"ticks\": \"\", \"zerolinecolor\": \"white\"}, \"yaxis\": {\"backgroundcolor\": \"#E5ECF6\", \"gridcolor\": \"white\", \"gridwidth\": 2, \"linecolor\": \"white\", \"showbackground\": true, \"ticks\": \"\", \"zerolinecolor\": \"white\"}, \"zaxis\": {\"backgroundcolor\": \"#E5ECF6\", \"gridcolor\": \"white\", \"gridwidth\": 2, \"linecolor\": \"white\", \"showbackground\": true, \"ticks\": \"\", \"zerolinecolor\": \"white\"}}, \"shapedefaults\": {\"line\": {\"color\": \"#2a3f5f\"}}, \"ternary\": {\"aaxis\": {\"gridcolor\": \"white\", \"linecolor\": \"white\", \"ticks\": \"\"}, \"baxis\": {\"gridcolor\": \"white\", \"linecolor\": \"white\", \"ticks\": \"\"}, \"bgcolor\": \"#E5ECF6\", \"caxis\": {\"gridcolor\": \"white\", \"linecolor\": \"white\", \"ticks\": \"\"}}, \"title\": {\"x\": 0.05}, \"xaxis\": {\"automargin\": true, \"gridcolor\": \"white\", \"linecolor\": \"white\", \"ticks\": \"\", \"title\": {\"standoff\": 15}, \"zerolinecolor\": \"white\", \"zerolinewidth\": 2}, \"yaxis\": {\"automargin\": true, \"gridcolor\": \"white\", \"linecolor\": \"white\", \"ticks\": \"\", \"title\": {\"standoff\": 15}, \"zerolinecolor\": \"white\", \"zerolinewidth\": 2}}}, \"width\": 1000, \"xaxis\": {\"anchor\": \"y\", \"domain\": [0.0, 1.0]}, \"xaxis2\": {\"anchor\": \"y2\", \"domain\": [0.0, 1.0]}, \"xaxis3\": {\"anchor\": \"y3\", \"domain\": [0.0, 1.0]}, \"xaxis4\": {\"anchor\": \"y4\", \"domain\": [0.0, 1.0]}, \"yaxis\": {\"anchor\": \"x\", \"domain\": [0.7949999999999999, 1.0]}, \"yaxis2\": {\"anchor\": \"x2\", \"domain\": [0.53, 0.7350000000000001]}, \"yaxis3\": {\"anchor\": \"x3\", \"domain\": [0.265, 0.47000000000000003]}, \"yaxis4\": {\"anchor\": \"x4\", \"domain\": [0.0, 0.20500000000000002]}},\n",
       "                        {\"responsive\": true}\n",
       "                    ).then(function(){\n",
       "                            \n",
       "var gd = document.getElementById('bec021a7-f50c-427c-915a-ce5359bc1d36');\n",
       "var x = new MutationObserver(function (mutations, observer) {{\n",
       "        var display = window.getComputedStyle(gd).display;\n",
       "        if (!display || display === 'none') {{\n",
       "            console.log([gd, 'removed!']);\n",
       "            Plotly.purge(gd);\n",
       "            observer.disconnect();\n",
       "        }}\n",
       "}});\n",
       "\n",
       "// Listen for the removal of the full notebook cells\n",
       "var notebookContainer = gd.closest('#notebook-container');\n",
       "if (notebookContainer) {{\n",
       "    x.observe(notebookContainer, {childList: true});\n",
       "}}\n",
       "\n",
       "// Listen for the clearing of the current output cell\n",
       "var outputEl = gd.closest('.output');\n",
       "if (outputEl) {{\n",
       "    x.observe(outputEl, {childList: true});\n",
       "}}\n",
       "\n",
       "                        })\n",
       "                };\n",
       "                });\n",
       "            </script>\n",
       "        </div>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "engine.load_data()\n",
    "engine.run_backtesting()\n",
    "df = engine.calculate_result()\n",
    "engine.calculate_statistics()\n",
    "engine.show_chart()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
